FROM microsoft/dotnet:2.2-sdk as build-env
WORKDIR /app
# 拷贝所有文件到环境中,并进行restore,build and release
COPY . ./
RUN dotnet restore
RUN dotnet build DockerDemo.csproj
RUN dotnet publish DockerDemo.csproj -c Release -o out

FROM microsoft/dotnet:2.2-aspnetcore-runtime
WORKDIR /app
#把发布好的文件拷贝到镜像中
COPY --from=build-env /app/out ./ 

EXPOSE 80 
ENTRYPOINT [ "dotnet", "DockerDemo.dll" ]
